import dayjs from '@/utils/day.js'
import util from '@/utils/util.js'

export function goShopDetail(item,uid) {	
	return new Promise(resolve => {
		console.log('item',item)
		if(item.type == 4){
			if(item.tour_type==1){
				uni.navigateTo({
					url: `/pages/product/ticketDetails/index?id=${item.product_id}`
				})	
			} else if(item.tour_type==2){
				if(item.buy_type == 1){
					uni.navigateTo({
						url: `/pages/product/details/index?id=${item.product_id}`
					})	
				} else {
					var tow = dayjs().add(1, 'day');
					var selectDay = tow.format('YYYY-MM-DD')
					uni.navigateTo({
						url: '/pages/bus/plan_list/index?date='+selectDay
						+'&start_city_id='+item.start_city_id
						+'&start_stop_id='+item.start_stop_id
						+'&end_city_id='+item.end_city_id
						+'&end_stop_id='+item.end_stop_id
						+'&origin='+item.start_stop_name
						+'&destination='+item.end_stop_name
					})
				}
				
				// uni.navigateTo({
				// 	url: `/pages/product/details/index?id=${item.product_id}`
				// })	
				
				
			}else if(item.tour_type==3 || item.tour_type==4 || item.tour_type==5 || item.tour_type==6){
				uni.navigateTo({
					url: `/pages/product/details/index?id=${item.product_id}`
				})	
			}
			
		} else {
			if (item.product_type === 1) {
				uni.navigateTo({
					url: `/pages/activity/goods_seckill_details/index?id=${item.product_id}&time=${item.stop_time}`
				})
			} else if (item.product_type === 2) {
				uni.navigateTo({
					url: `/pages/activity/presell_details/index?id=${item.activity_id}`
				})
			} else if (item.product_type === 0 || item.product_type === 10) {
				uni.navigateTo({
					url: `/pages/goods_details/index?id=${item.product_id}`
				})	
			}else if (item.product_type === 4) {
				uni.navigateTo({
					url: `/pages/activity/combination_details/index?id=${item.activity_id}`
				})
			}else if (item.product_type === 40) {
				uni.navigateTo({
					url: `/pages/activity/combination_status/index?id=${item.activity_id}`
				})
			}else {
				resolve(item);
			}
		}
		
		
	});
}
